import type { KnowledgeDetail, Category } from '@/types/knowledge';
import { allKnowledgeCards, categories } from '@/data/knowledge';

/**
 * 根据分类ID获取知识点
 */
export function getKnowledgeByCategory(categoryId: string): KnowledgeDetail[] {
	return allKnowledgeCards.filter(card => card.categoryId === categoryId);
}

/**
 * 根据ID获取知识点
 */
export function getKnowledgeById(id: number): KnowledgeDetail | undefined {
	return allKnowledgeCards.find(card => card.id === id);
}

/**
 * 获取所有知识点
 */
export function getAllKnowledgeCards(): KnowledgeDetail[] {
	return allKnowledgeCards;
}

